package com.ruoyi.inventory.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.InventoryWarningMapper;
import com.ruoyi.inventory.domain.InventoryWarning;
import com.ruoyi.inventory.service.IInventoryWarningService;
import com.ruoyi.common.core.text.Convert;

/**
 * 库存预警设置Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-17
 */
@Service
public class InventoryWarningServiceImpl implements IInventoryWarningService 
{
    @Autowired
    private InventoryWarningMapper inventoryWarningMapper;

    /**
     * 查询库存预警设置
     * 
     * @param id 库存预警设置主键
     * @return 库存预警设置
     */
    @Override
    public InventoryWarning selectInventoryWarningById(Long id)
    {
        return inventoryWarningMapper.selectInventoryWarningById(id);
    }

    /**
     * 查询库存预警设置列表
     * 
     * @param inventoryWarning 库存预警设置
     * @return 库存预警设置
     */
    @Override
    public List<InventoryWarning> selectInventoryWarningList(InventoryWarning inventoryWarning)
    {
        return inventoryWarningMapper.selectInventoryWarningList(inventoryWarning);
    }

    /**
     * 新增库存预警设置
     * 
     * @param inventoryWarning 库存预警设置
     * @return 结果
     */
    @Override
    public int insertInventoryWarning(InventoryWarning inventoryWarning)
    {
        return inventoryWarningMapper.insertInventoryWarning(inventoryWarning);
    }

    /**
     * 修改库存预警设置
     * 
     * @param inventoryWarning 库存预警设置
     * @return 结果
     */
    @Override
    public int updateInventoryWarning(InventoryWarning inventoryWarning)
    {
        inventoryWarning.setUpdateTime(DateUtils.getNowDate());
        return inventoryWarningMapper.updateInventoryWarning(inventoryWarning);
    }

    /**
     * 批量删除库存预警设置
     * 
     * @param ids 需要删除的库存预警设置主键
     * @return 结果
     */
    @Override
    public int deleteInventoryWarningByIds(String ids)
    {
        return inventoryWarningMapper.deleteInventoryWarningByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除库存预警设置信息
     * 
     * @param id 库存预警设置主键
     * @return 结果
     */
    @Override
    public int deleteInventoryWarningById(Long id)
    {
        return inventoryWarningMapper.deleteInventoryWarningById(id);
    }
}
